package com.ewzj.bigdata.mvp.ui.holder

import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView

import com.bigkoo.convenientbanner.holder.Holder
import com.bumptech.glide.Glide
import com.ewzj.bigdata.R
import com.ewzj.bigdata.mvp.model.rspbean.DecPicBean

/**
 * author:zhangjing
 * 作用:
 * return:
 */

class PhotoPreViewHolderView : Holder<DecPicBean.PicsEntity> {
    private var view: View? = null
    override fun createView(context: Context): View {
        val layoutInflater = LayoutInflater.from(context)
        view = layoutInflater.inflate(R.layout.item_preview, null, false)
        return view!!
    }

    override fun UpdateUI(context: Context, position: Int, data: DecPicBean.PicsEntity) {
        //        AppUtils.loadImgwithloading(context,data.getBigimg(),viewHolder.ivVideo);
        Glide.with(context).load(data.bigimg)
                //                .thumbnail(0.1f)
                .dontAnimate()
                .dontTransform()
                //                .override(800,800)
                .placeholder(R.drawable.ic_loading)
                .into(view!!.findViewById(R.id.iv_video) as ImageView)
        (view!!.findViewById(R.id.tv_desc) as TextView).text = data.title
        view!!.findViewById(R.id.iv_video).setOnClickListener { (context as Activity).finish() }
    }
}
